package com.briup.day37;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;

public class FileCopy  {
	public static void main(String[] args) throws Exception {
		
		
		String path = "src/com/briup/day37/on my way.mp3";    //原文件的路径
		InputStream is = new FileInputStream(path);  
		String path1 = "src/com/briup/day37/newmusic.mp3";   //要复制到的路径
		FileOutputStream fos = new FileOutputStream(path1);
		
		byte buf[] = new byte[is.available()];   //临时available+使用缓冲数组批量读取字节
        int len = -1;    // 用来保存每次实际读取到的字节数量
        while((len = is.read(buf)) != -1){  
            fos.write(buf, 0, len);   
        }
        
        is.close();
        fos.close();
        
        System.out.println("文件拷贝成功！");

	}
	

}
